<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    div{
        width: 300px;
        height: 300px;
        background: #000;
        color: #fff;
        margin: 200px auto;
        box-sizing: border-box;
    }
</style>
<body>
    <div>鼠标移入变色，移出恢复</div>
</body>
</html>
<script>
    var div=document.querySelector('div')
    div.onmousemove=function(){
        div.style.padding='20px'
        div.style.background='blue'
        div.style.color='red'
    }
    div.onmouseout=function(){
        div.style.padding='0px'
        div.style.background='#000'
        div.style.color='#fff'
    }
</script>